<template>
  <div>
    <p>child</p>
    <p>{{ num }}</p>
    <button @click="handleClick">修改</button>
  </div>
</template>

<script lang="ts">
export default {
  name: "Child",
  // props: ['num'],
  props: {
    // num: Number,
    num: {
      type: Number,
      required: true,
    },
  },
  // 声明接受自定义事件
  emits: ["click"],
  methods: {
    handleClick() {
      // 触发自定义事件
      this.$emit("click");
    },
  },
};
</script>

<style scoped></style>
